﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DaInterFace.UMode
{
    public interface IUMode
    {
        Dictionary<String, IUModeHole> HoleList { get; }
        /// <summary>
        /// 消息事件
        /// </summary>
        event MessageHandler MessageEvent;
        /// <summary>
        /// 添加料口事件
        /// </summary>
        event AddUModeHoleHandler AddHoleEvent;
        /// <summary>
        /// 添加门禁事件
        /// </summary>
        event AddUModeGateHandler AddGateEvent;
        /// <summary>
        /// 清空事件
        /// </summary>
        event ClearUModeItemHandler ClearEvent;
        /// <summary>
        /// 显示消息，会触发MessageEvent事件
        /// </summary>
        /// <param name="type">消息类型</param>
        /// <param name="note">消息内容</param>
        void Message(MessageType type, String note);
        /// <summary>
        /// 显示消息，会触发MessageEvent事件
        /// </summary>
        /// <param name="type">消息类型</param>
        /// <param name="note">消息内容</param>
        /// <param name="span">耗时</param>
        void Message(MessageType type, String note, Double span);
        /// <summary>
        /// 加载/重新加载
        /// </summary>
        void Load();
    }

    public interface IUModeHole
    {
        /// <summary>
        /// 即时消息
        /// </summary>
        event IMessageHandler IMessageEvent;

        /// <summary>
        /// 料口名称
        /// </summary>
        String PortName { get; }
        /// <summary>
        /// 物料信息
        /// </summary>
        String ItemName { get; }
        /// <summary>
        /// 当前装车的车辆信息
        /// </summary>
        MeterInfoObject MeterInfo { get; }

        void Dispose();

        void Allow();

        void Forbid();
    }

    public interface IUModeGate
    {
        /// <summary>
        /// 即时消息
        /// </summary>
        event IMessageHandler IMessageEvent;

        /// <summary>
        /// 门禁名称
        /// </summary>
        String GateName { get; }
        /// <summary>
        /// 门禁类型
        /// </summary>
        EnumGateType GateType { get; }
        /// <summary>
        /// 当前车辆信息
        /// </summary>
        MeterInfoObject MeterInfo { get; }

        void Dispose();

        void Allow();
    }

    public enum EnumGateType : int
    { 
        Ins = 0,
        Out = 1
    }

    public delegate void AddUModeHoleHandler(IUModeHole item);
    public delegate void AddUModeGateHandler(IUModeGate item);

    public delegate void ClearUModeItemHandler();
}
